package com.freight.order.dao;

import com.freight.core.base.FreightBaseDao;
import com.freight.order.entity.OrderOrder;
import com.freight.order.vo.OrderStateCntVo;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 货物续期需求数据处理层
 *
 * @author huyingtai
 */
public interface OrderOrderDao extends FreightBaseDao<OrderOrder, Long> {


    /**
     * 返回货主的订单概览
     *
     * @return
     */
    @Query(value = "select new com.freight.order.vo.OrderStateCntVo(o.orderState,'未知',count(o.id)) " +
            "from OrderOrder o GROUP BY  o.orderState")
    List<OrderStateCntVo> getCompanyOrderStateCnt();


    /**
     *
     * @param goodId
     * @return
     */
    OrderOrder getByGoodsId(Long goodId);


    /**
     *
     * @param orderNo
     * @return
     */
    OrderOrder getByOrderNo(String orderNo);

    /**
     *
     * @param ids
     * @return
     */
    List<OrderOrder> getByIdIn(Long[] ids);



}